<?php
/**
 * EGP Framework
 *
 * LICENSE
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author     hyperjiang <hyperjiang@gmail.com>
 * @copyright  Copyright (c) 2008-2009 (http://mydraft.cn)
 * @license    http://www.gnu.org/licenses/gpl.html     GPL 3
 */

!defined('EGP_LIB_DIR') && die('Access Deny!');

/**
 * 小型分页样式
 *
 * @package    classes
 * @author     hyperjiang <hyperjiang@gmail.com>
 * @copyright  Copyright (c) 2008-2009 (http://mydraft.cn)
 * @license    http://www.gnu.org/licenses/gpl.html     GPL 3
 */
class EGP_Paginator_Style_Small extends EGP_Paginator_Style_Abstract
{

    /**
     * 输出分页 HTML 代码
     *
     * @return string
     */
    public function __toString()
    {
        if ($this->pagesCount <= 1) {
            return '&nbsp;';
        }
        $html = '<span class="text">翻页：</span>';
        if ($this->currentPage > 1) {
            $html .= ' <a class="pagePrev" href="' . $this->getPageLink($this->previousPage) . '" title="前往上一页">◄<span>上一页</span></a>';
        } else {
            $html .= ' <a class="noPrev" title="已经是第一页了">◄<span>上一页</span></a>';
        }
        if ($this->currentPage < $this->lastPage) {
            $html .= ' <a class="pagePrev" href="' . $this->getPageLink($this->nextPage) . '" title="前往下一页"><span>下一页</span>►</a>';
        } else {
            $html .= ' <a class="noNext" title="已经是最后一页了"><span>下一页</span>►</a>';
        }
        return "\n<div class=\"smallPagination\">\n$html</div>\n";
    }

}